package com.jwgf.smarowindingmachine_unity.ui;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;

import com.jwgf.Half485.modbusthreadpool.ModbusCommandManager;
import com.jwgf.smarowindingmachine_unity.R;
import com.jwgf.smarowindingmachine_unity.logic.CommandGenerator;

public class ParameterSettingStackingRobotParameterFragment extends BaseFragment implements OnClickListener{
	public static final String fragmentTag = "ParameterSettingStackingRobotParameterFragment";
	private Button btnFaultClear;
	static View thisView = null;
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View v = inflater.inflate(R.layout.fragment_parameter_setting_stacking_robot_parameter, container, false);
		thisView = v;
		return v;
	}
	
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		initialViews(thisView);
	}
	
	private void initialViews(View v) {
		btnFaultClear = (Button) v.findViewById(R.id.btn_lifter_fault_clear);
		btnFaultClear.setOnClickListener(this);
	}
	
	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_lifter_fault_clear: {
			byte[] datai = new byte[2];
			datai[0] = (byte) ((0 & 0xff00) >> 8);
			datai[1] = (byte) (0 & 0xff);
			ModbusCommandManager.getInstance()
					.putPriorityCmd(CommandGenerator.createWriteCommand(
							(byte) 1, 202, datai));//4
		}
		break;
 	  }
	}
	
}
